export default (cellName) => {
    let r = cellName.match(/^[A-Z]+/g);
    const colIndex = stringTonum(r[0]);
    r = cellName.match(/\d+$/g);
    const rowIndex = Number(r[0]);
    return { rowIndex: rowIndex - 1, colIndex: colIndex - 1 };
}

function stringTonum(str) {
    let al = str.length;
    let getCharNumber = function (charx) {
        return charx.charCodeAt() - 64;
    };
    let numout = 0;
    let charnum = 0;
    for (let i = 0; i < al; i++) {
        charnum = getCharNumber(str[i]);
        numout += charnum * Math.pow(26, al - i - 1);
    };
    return numout;
}
